package com.horay.springclouddemo.gateway.configuration;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 网关配置
 *
 * @author heyingcheng
 * @date 2020/3/24 17:05
 */
@Configuration
public class GatewayConfiguration {

    @Bean
    public RouteLocator routes(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("hystrix-route", r -> r.path("/hystrix/**").and().uri("lb://demo-provider-hystrix"))
                .build();
    }

}
